<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img :src="bannerImg" alt="" class="banner-img">
      <div class="banner-info">
        <div class="banner-title">{{sightName}}</div>
        <div class="banner-number">
          <span class="iconfont banner-icon">&#xe692;</span>
          <span>{{gallaryImgs.length}}</span>
        </div>
      </div>
    </div>
    <fade-anim>
      <common-gallery :imgs='gallaryImgs' v-show='showGallery'
        @hideGallery='hideGallery'
      ></common-gallery>
    </fade-anim>
  </div>
</template>
<script>
import CommonGallery from 'common/gallery/Gallery'
import FadeAnim from 'common/fade/FadeAnim'
export default {
  name: 'DetailBanner',
  props: {
    sightName: String,
    bannerImg: String,
    gallaryImgs: Array
  },
  data () {
    return {
      showGallery: false
    }
  },
  components: {
    CommonGallery, FadeAnim
  },
  methods: {
    handleBannerClick () {
      this.showGallery = true
    },
    hideGallery () {
      this.showGallery = false
    }
  }
}
</script>
<style lang='stylus' scoped>
.banner
  position: relative
  overflow: hidden
  height: 0
  padding-bottom: 55%
  .banner-img
    width: 100%
  .banner-info
    color: #fff
    z-index: 1
    display: flex
    position: absolute
    left: 0
    right: 0
    bottom: 0
    line-height: .6rem
    .banner-title
      text-align: left
      font-size: .32rem
      padding: 0 .2rem
      flex: 1
    .banner-number
      margin: .14rem
      padding: 0 .4rem
      line-height: .32rem
      height: .32rem
      font-size: .24rem
      border-radius: .2rem
      background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8))
      .banner-icon
        font-size: .24rem
        padding-right: .07rem
</style>
